<template>
    <div class="forgetpwd-wrap">
        <div class="ms-forgetpwd">
            <div class="ms-title">MMC后台管理系统</div>
            <el-form :model="param" :rules="rules" ref="forgetpwd" label-width="0px" class="ms-content">
                <!-- 输入用户名 -->
                <el-form-item prop="username">
                    <el-input v-model="param.username" placeholder="username">
                        <el-button slot="prepend" icon="el-icon-lx-people"></el-button>
                    </el-input>
                </el-form-item>
                <!-- 输入邮箱 -->
                <el-form-item prop="email">
                    <el-input
                        type="email"
                        placeholder="email"
                        v-model="param.email"
                        @keyup.enter.native="submitForm()"
                    >
                        <el-button slot="prepend" icon="el-icon-lx-mail"></el-button>
                    </el-input>
                </el-form-item>
                <div class="forgetpwd-btn">
                    <el-button type="primary" @click="submitForm()">修改密码</el-button>
                </div>
                
                <p class="forgetpwd-tips">Tips : 请及时进入邮箱重置密码。
                </p>
                
            </el-form>
        </div>
    </div>
</template>

<script>
    import{sendmail} from '../../api/api'
export default {
    data: function() {
        return {
            param: {
                username: '',
                email:'',
            },
            rules: {
                username: [{ required: true, message: '请输入用户名', trigger: 'blur' }],
                email: [{ required: true, message: '请输入邮箱', trigger: 'blur' }],
            },
        };
    },
    methods: {
        submitForm() {
            var params = {
                username:this.param.username,
                email:this.param.email,
            }
            sendmail(params).then(resp=>{
                this.$message(resp.message)
            })
        },
    },
};
</script>

<style scoped>
.forgetpwd-wrap {
    position: relative;
    width: 100%;
    height: 100%;
    background-image: url(../../assets/img/login-bg2.png);
    background-size: 100%;
}
.ms-title {
    width: 100%;
    line-height: 50px;
    text-align: center;
    font-size: 20px;
    color: #fff;
    border-bottom: 1px solid #ddd;
}
.ms-forgetpwd {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 350px;
    margin: -190px 0 0 -175px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.3);
    overflow: hidden;
}
.ms-content {
    padding: 30px 30px;
}
.forgetpwd-btn {
    text-align: center;
}
.forgetpwd-btn button {
    width: 100%;
    height: 36px;
    margin-bottom: 10px;
    border: 1px;
}
.forgetpwd-tips {
    font-size: 12px;
    line-height: 30px;
    color: #fff;
}
</style>